home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- //Borland C++Builder
- //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
-
- #include "CloneTab.h"
-
-
- __fastcall TCloneTable::TCloneTable(TComponent* AOwner,bool Reset) : TTable(AOwner)
- {
- InitFromTable(dynamic_cast <TTable*>(AOwner), Reset);
- }
-
- void __fastcall TCloneTable::InitFromTable(TTable* SourceTable, bool Reset)
- {
- TableName = SourceTable->TableName;
- DatabaseName = SourceTable->DatabaseName;
- if (IndexName != "") IndexName = SourceTable->IndexName;
- else if (IndexFieldNames != "") IndexFieldNames = SourceTable->IndexFieldNames;
- SetSourceHandle(SourceTable->Handle);
- Filter = SourceTable->Filter;
- OnFilterRecord = SourceTable->OnFilterRecord;
- Filtered = SourceTable->Filtered;
-
- if (Reset) {
- Filtered = false; //turn off filters
- DbiResetRange(FSourceHandle); // kill ranges
- IndexName = ""; // kill indexes
- First(); // put clone table at first record
- }
- }
-
- void __fastcall TCloneTable::SetSourceHandle(hDBICur ASourceHandle)
- {
- if (ASourceHandle != FSourceHandle) { // if not same cursor
- Close(); // close table first if open
- FSourceHandle = ASourceHandle; // Clone handle cursor = sourcetable cursor
- if (FSourceHandle)
- Open(); // if not null
- }
- }
-
- hDBICur __fastcall TCloneTable::CreateHandle() // this creates the Clone cursor handle
- {
- hDBICur Cur; //FSourceHandle should hold the source handle
- Check(DbiCloneCursor(FSourceHandle, false, false, Cur));
- return Cur; //return clone cursor
- }
-
-
-